<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <form action="?" method="post" enctype="multipart/form-data">
        关键字：<input type="file" name="file">
        <input type="submit" name="sub" value="上传">
    </form>
</body>
</html>
<?php
/**
 * User: lie
 * Date: 2020/12/3 13:52
 * Title:
 * Description:
 * Error:
 */
    if (!empty($_POST['sub'])) {
        $a = strrev($_FILES['file']['name']);    // 反转字符串
        $b = explode('.', $a);          // 以点号分割
        $c = strrev($b[0]);                     // 反转字符串
        echo "文件后缀为：".$c;
    }
?>